import request from '../../util/request'

export default {

  /**
   *  添加品牌
   * @param params
   * @private
   */
  __api__BrandsAdd:(params)=>{
    return request({
      url: '/brands',
      method:'post',
      data:params
    })
  },

  /**
   *  删除品牌
   * @param params
   * @private
   */
  __api__BrandsDelete:(params)=>{
    return request({
      url:'/brands',
      method:'delete',
      data:params
    })
  },

  /**
   *  为品牌删除分类
   * @param brandId
   * @param cateId
   * @private
   */
  __api__BrandsCategoryDelete:(brandId, cateId)=>{
    return request({
      url:'/brands/cate',
      method:'delete',
      data:{brandId:brandId,cateId:cateId}
    })
  },

  /**
   *  为品牌添加分类
   * @param brandId
   * @param cateId
   * @private
   */
  __api__BrandsCategoryAdd:(brandId, cateId)=>{
    return request({
      url:'/brands/cate',
      method:'post',
      data:{brandId:brandId,cateId:cateId}
    })
  },

  /**
   *  获取品牌详情
   * @param id
   * @private
   */
  __api__BrandsDetails:(id)=>{
    return request({
      url:'/brands/'+id,
      method:'get'
    })
  },

  /**
   *  更新品牌状态
   * @param id
   * @param status
   * @private
   */
  __api__BrandsStatusUpdate:(id, status)=>{
    return request({
      url:'/brands/status',
      method:'patch',
      data:{id:id,status:status}
    })
  },

  /**
   *  分页获取品牌
   * @param params
   * @private
   */
  __api__BrandsPage:(params)=>{
    return request({
      url:'/brands',
      methods:'get',
      params:params
    })
  },

  /**
   *  查询某个分类下的品牌列表
   * @param cateId
   * @private
   */
  __api__BrandsOfCategory:(cateId)=>{
    return request({
      url:'/brands/cate/'+cateId,
      methods:'get'
    })
  },

  /**
   *  通过关键字搜索品牌，只做名称的模糊匹配
   * @param query
   * @private
   */
  __api__BrandsByQuery:(query)=>{
    return request({
      url:'/brands/query',
      method:'get',
      params:{query}
    })
  }


}
